import service from "@/tools/request"

//获取文章列表
const getArticleList = function(currentPage,pageSize) {
    return service({
        url:"www/article/getArticleList",
        method:"get",
        params:{
            currentPage,
            pageSize
        }
    })
}
//通过id获取文章详情
const getArticleById = function(id){
    return service({
        url:"www/article/getArticleById",
        method:"get",
        params:{
            id
        }
    })
}
//获取浏览最多的前10个文章
const getTopViewsArticle = function(){
    return service({
        url:"www/article/getTopViewsArticle",
        method:"get"
    })
}
//获取搜索获得的文章列表
const getArticleByKeyword = function(keyword,currentPage,pageSize){
    return service({
        url:"www/article/getArticleByKeyword",
        method:"get",
        params:{
            keyword,
            currentPage,
            pageSize
        }
    })
}
//根据文章分类查询
const getArticleByCategory = function(type,currentPage,pageSize){
    return service({
        url:"www/article/getArticleByCategory",
        method:"get",
        params:{
            type,
            currentPage,
            pageSize
        }
    })
}
export {
    getArticleList,
    getArticleById,
    getTopViewsArticle,
    getArticleByKeyword,
    getArticleByCategory
}